<?php

// Rückgabe an das Template initialisieren
$to_tpl = array();
// Zu ladendes Template übergeben
$to_tpl['filename'] = 'object_overview.tpl';
// Datenarray initialisieren
$to_tpl['data'] = array();
$to_tpl['data']['categories'] = array();

if ((isset($_GET['cat_id'])) && (is_numeric($_GET['cat_id']))) {
    $cat_id = $_GET['cat_id'];
} else
    $cat_id = 0;

$categories = get_level_categories($cat_id);

foreach ($categories as $cat_id => $cat_name) {
    $new_cat = array();
    $new_cat['cat_id'] = $cat_id;
    $new_cat['cat_name'] = $cat_name;
    $new_cat['image_url'] = get_image(get_categorie_image($cat_id));
    $to_tpl['data']['categories'][$cat_id] = $new_cat;
    unset($new_cat);
}





$find_obj = array();


$find_obj['obj_cat_id'] = $cat_id;

$to_tpl['data']['objects'] = find_objects($find_obj);

//Image ID's in URLs übersetzen
foreach ($to_tpl['data']['objects'] as $tmp_id => $tmp_object) {
    if (isset($tmp_object["obj_img_id"])) {
        $to_tpl['data']['objects'][$tmp_id]["obj_img_url"] = get_image($tmp_object["obj_img_id"]);
    } else {
        $to_tpl['data']['objects'][$tmp_id]["obj_img_url"] = get_image(IMAGE_NA_ID);
    }
}

unset($tmp_id, $tmp_object, $func_name);













return $to_tpl;
?>

